!{include file='common/iheader.htm'}
<div id="i_nav">
	<h3 class="page_title">广告管理</h3>
	<a class="button" href="/manager.php?app=ad&act=edit">创建广告</a>
</div>
<ul class="list_view">
	!{foreach from=$ads item=ad key=id}
	<li>
		<strong id="ad_!{$id}"><a href="/manager.php?app=ad&act=edit&id=!{$id}">!{$ad.desc}</a></strong>
		<div class="opt_div">
			<a href="javascript:void(0)" onclick="del('!{$id}')">删除</a>
			<a href="/manager.php?app=ad&act=edit&id=!{$id}">修改</a>
			<a href="/manager.php?app=ad&act=view&id=!{$id}">预览</a>
		</div>
	</li>
	!{foreachelse}
	<li>
		<strong>暂无记录...<a href="/manager.php?app=ad&act=edit">马上添加</a></strong>
	</li>
	!{/foreach}
</ul>
<div class="option_div">
	<div class="pager">
	!{include file='common/pager.htm'}
	</div>
</div>
<script>
	function del(id){
		var name = $("#ad_" + id).text();
		if(confirm("是否确定要删除广告：" + name)){
			$.get('/manager.php?app=ad&act=del&id=' + id, function(data){
				var json = eval("(" + data + ")");
				alert(json.info);
				if(json.result){
					//删除成功
					window.location.reload();
				}
				
			});
		}
	}
</script>
!{include file='common/ifooter.htm'}
